//
//  NoticeTableVC.m
//  Xfdsh
//
//  Created by aa on 01/03/2018.
//  Copyright © 2018 金刚葫芦娃. All rights reserved.
//

#import "NoticeTableVC.h"

@implementation NoticeTableVC
- (void)layoutSubviews
{
    [super layoutSubviews];
    
//    for (UIView *subView in self.subviews) {
//        NSLog(@"%@",NSStringFromClass([subView class]));
//        if ([NSStringFromClass([subView class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]) {
////            UIImageView *bgView=(UIImageView *)[subView.subviews firstObject];
////            bgView.image = [UIImage imageNamed:@"Group 5"];
//            UIView *bgView=(UIView *)[subView.subviews firstObject];
//            bgView.backgroundColor = [UIColor whiteColor];
//        }
//    }
}
- (UIView *)cellBackView{
    if (!_cellBackView) {
        _cellBackView = [[UIView alloc]init];
        _cellBackView.backgroundColor = [UIColor colorWithRed:0.9333 green:0.9333 blue:0.9412 alpha:1];
        _cellBackView.layer.cornerRadius = 10;
        _cellBackView.layer.masksToBounds = YES;
    }
    return _cellBackView;
}
#pragma mark - 时间
- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = [UIFont systemFontOfSize:15];
        _timeLabel.textColor = [UIColor darkGrayColor];
        _timeLabel.text = @"9:00\nAM";
        _timeLabel.numberOfLines = 2;
        _timeLabel.textAlignment = 1;
    }
    return _timeLabel;
}
#pragma mark - 已读
- (UILabel *)isReadLable{
    if (!_isReadLable) {
        _isReadLable = [[UILabel alloc]init];
        _isReadLable.text = @"未读";
        _isReadLable.textColor = [UIColor whiteColor];
        _isReadLable.font = [UIFont systemFontOfSize:14];
        _isReadLable.textAlignment = 1;
        _isReadLable.layer.cornerRadius = 3;
        _isReadLable.layer.masksToBounds = YES;
        _isReadLable.backgroundColor = MAINPRICECOLOR;
    }
    return _isReadLable;
}
#pragma mark - 主标题
- (UILabel *)topLabel{
    if (!_topLabel) {
        _topLabel = [[UILabel alloc]init];
        _topLabel.font = [UIFont systemFontOfSize:16];
        _topLabel.textColor = [UIColor blackColor];
        _topLabel.numberOfLines = 0;
    }
    return _topLabel;
}
#pragma mark -detail
- (UILabel *)detailLabel{
    if (!_detailLabel) {
        _detailLabel = [[UILabel alloc]init];
        _detailLabel.font = [UIFont systemFontOfSize:16];
        _detailLabel.textColor = [UIColor lightGrayColor];
        _detailLabel.numberOfLines = 0;
    }
    return _detailLabel;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    [self addSubview:self.cellBackView];
    [_cellBackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.top.equalTo(@5);
        make.bottom.equalTo(@0).offset(-5);
    }];
    [_cellBackView addSubview:self.timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.centerY.equalTo(_cellBackView.mas_centerY);
        make.width.equalTo(@60);
        make.height.equalTo(@40);
    }];
    [_cellBackView addSubview:self.isReadLable];
    [_isReadLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_timeLabel.mas_right).offset(5);
        make.centerY.equalTo(_timeLabel.mas_centerY);
        make.width.equalTo(@40);
        make.height.equalTo(@20);
    }];
    [_cellBackView addSubview:self.topLabel];
    [_topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_isReadLable.mas_right).offset(10);
        make.right.equalTo(_cellBackView.mas_right).offset(-5);
        make.top.equalTo(@10);
        make.bottom.equalTo(_cellBackView.mas_centerY);
    }];
    [_cellBackView addSubview:self.detailLabel];
    [_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_isReadLable.mas_right).offset(10);
        make.right.equalTo(_cellBackView.mas_right).offset(-5);
        make.top.equalTo(_topLabel.mas_bottom);
        make.bottom.equalTo(_cellBackView.mas_bottom).offset(-10);
    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
